미세먼지 주범 석탄화력발전소, 대선 후보 입장은? 한겨례 신문 2017년 기사를 보면 석탄화력발전소에 대한 구체적인 정보가 담겨있다. World Resources Institute Global Power Plant Database 에서 전세계 화력발전소 중 한국만 추려 본다.
library(tidyverse)
plant_df <- read_csv("data/globalpowerplantdatabasev120/global_power_plant_database.csv")
plant_tbl <- plant_df %>%
filter(country == "KOR") %>%
select("name", "capacity_mw", "latitude", "longitude", fuel = "primary_fuel", year = "commissioning_year", "owner", "url",
generation_gwh = "estimated_generation_gwh")
plant_tbl %>%
reactable::reactable()회사별 용량과 발전양 순위는 다음과 같다.
library(reactable)
plant_tbl %>%
group_by(owner) %>%
summarise(capacity_mw = sum(capacity_mw, na.rm = TRUE),
generation_gwh = sum(generation_gwh, na.rm = TRUE)) %>%
arrange(desc(generation_gwh)) %>%
reactable::reactable( columns = list(
owner = colDef(name = "소유 회사", minWidth = 100),
capacity_mw = colDef(name = "용량(MW)", format = colFormat(digits = 0, separators = TRUE)),
generation_gwh = colDef(name = "발전(GWh)", format = colFormat(digits = 0, separators = TRUE))
))plant_tbl %>%
group_by(fuel) %>%
summarise(capacity_mw = sum(capacity_mw, na.rm = TRUE),
generation_gwh = sum(generation_gwh, na.rm = TRUE)) %>%
ungroup() %>%
arrange(desc(generation_gwh)) %>%
mutate(용량비율 = capacity_mw / sum(capacity_mw),
발전비율 = generation_gwh / sum(generation_gwh)) %>%
bind_rows(summarise(.,
across(where(is.numeric), sum),
across(where(is.character), ~"합계"))) %>%
reactable::reactable( defaultPageSize = 11,
columns = list(
fuel = colDef(name = "연료", minWidth = 70),
capacity_mw = colDef(name = "용량(MW)", format = colFormat(digits = 0, separators = TRUE)),
용량비율 = colDef(name = "용량비율", format = colFormat(percent = TRUE, digits = 1)),
generation_gwh = colDef(name = "발전(GWh)", format = colFormat(digits = 0, separators = TRUE)),
발전비율 = colDef(name = "발전비율", format = colFormat(percent = TRUE, digits = 1))
))plant_tbl %>%
group_by(fuel, owner) %>%
summarise(capacity_mw = sum(capacity_mw, na.rm = TRUE)) %>%
pivot_wider(names_from = fuel, values_from = capacity_mw, values_fill = 0) %>%
arrange(desc(Coal)) %>%
reactable::reactable( defaultPageSize = 10,
columns = list(
owner = colDef(name = "회사", minWidth = 150),
Biomass = colDef(name = "바이오", format = colFormat(digits = 0, separators = TRUE)),
Coal = colDef(name = "석탄", format = colFormat(digits = 0, separators = TRUE)),
Gas = colDef(name = "가스", format = colFormat(digits = 0, separators = TRUE)),
Hydro = colDef(name = "수력", format = colFormat(digits = 0, separators = TRUE)),
Nuclear = colDef(name = "원자력", format = colFormat(digits = 0, separators = TRUE)),
Oil = colDef(name = "원유", format = colFormat(digits = 0, separators = TRUE)),
Solar = colDef(name = "태양열", format = colFormat(digits = 0, separators = TRUE)),
Waste = colDef(name = "폐열", format = colFormat(digits = 0, separators = TRUE)),
`Wave and Tidal` = colDef(name = "해수", format = colFormat(digits = 0, separators = TRUE)),
Wind = colDef(name = "풍력", format = colFormat(digits = 0, separators = TRUE))
)) plant_tbl %>%
group_by(fuel, owner) %>%
summarise(generation_gwh = sum(generation_gwh, na.rm = TRUE)) %>%
pivot_wider(names_from = fuel, values_from = generation_gwh, values_fill = 0) %>%
arrange(desc(Coal)) %>%
reactable::reactable( defaultPageSize = 10,
columns = list(
owner = colDef(name = "회사", minWidth = 150),
Biomass = colDef(name = "바이오", format = colFormat(digits = 0, separators = TRUE)),
Coal = colDef(name = "석탄", format = colFormat(digits = 0, separators = TRUE)),
Gas = colDef(name = "가스", format = colFormat(digits = 0, separators = TRUE)),
Hydro = colDef(name = "수력", format = colFormat(digits = 0, separators = TRUE)),
Nuclear = colDef(name = "원자력", format = colFormat(digits = 0, separators = TRUE)),
Oil = colDef(name = "원유", format = colFormat(digits = 0, separators = TRUE)),
Solar = colDef(name = "태양열", format = colFormat(digits = 0, separators = TRUE)),
Waste = colDef(name = "폐열", format = colFormat(digits = 0, separators = TRUE)),
`Wave and Tidal` = colDef(name = "해수", format = colFormat(digits = 0, separators = TRUE)),
Wind = colDef(name = "풍력", format = colFormat(digits = 0, separators = TRUE))
)) library(glue)
library(leaflet)
plant_tbl %>%
leaflet() %>%
addProviderTiles(provider = providers$OpenStreetMap) %>%
addMarkers(lng=~longitude, lat = ~latitude, clusterOptions = markerClusterOptions(),
popup = ~ as.character(glue("<strong> {name} </strong> <br>
· 회사: {owner}<br>
· 용량: {scales::comma(capacity_mw, accuracy = 1) } MW<br>
· 발전: {scales::comma(generation_gwh, accuracy = 1)} GWh<br>
· 연료: {fuel}")))plant_tbl %>%
filter(fuel == "Coal") %>%
leaflet() %>%
addProviderTiles(provider = providers$OpenStreetMap) %>%
addMarkers(lng=~longitude, lat = ~latitude, clusterOptions = markerClusterOptions(),
popup = ~ as.character(glue("<strong> {name} </strong> <br>
· 회사: {owner}<br>
· 용량: {scales::comma(capacity_mw, accuracy = 1) } MW<br>
· 발전: {scales::comma(generation_gwh, accuracy = 1)} GWh<br>
· 연료: {fuel}")))library(sf)
korea_sf <- st_read("data/map/HangJeongDong_ver20201001.geojson")Reading layer `1' from data source `/Users/kwangchunlee/swc/esg/data/map/HangJeongDong_ver20201001.geojson' using driver `GeoJSON'
Simple feature collection with 3492 features and 8 fields
geometry type: MULTIPOLYGON
dimension: XY
bbox: xmin: 124.6097 ymin: 33.11187 xmax: 131.8713 ymax: 38.61695
geographic CRS: WGS 84
sido_sf <- korea_sf %>%
group_by(sido, sidonm) %>%
summarise(cnt = n()) %>%
ungroup() %>%
select(-cnt)
plant_tbl %>%
filter(fuel == "Coal") %>%
leaflet() %>%
## 석탄 화력 발전소 위치 --------------------------------------
addProviderTiles(provider = providers$OpenStreetMap) %>%
addMarkers(lng=~longitude, lat = ~latitude, clusterOptions = markerClusterOptions(),
popup = ~ as.character(glue("<strong> {name} </strong> <br>
· 회사: {owner}<br>
· 용량: {scales::comma(capacity_mw, accuracy = 1) } MW<br>
· 발전: {scales::comma(generation_gwh, accuracy = 1)} GWh<br>
· 연료: {fuel}"))) %>%
## 시도 경계 shapefile --------------------------------------
addPolygons(data = sido_sf, opacity = 1.0, fillOpacity = 0.1,
weight = 1,
highlightOptions = highlightOptions(color = "black", weight = 3, bringToFront = TRUE),
labelOptions = labelOptions(
style = list("font-weight" = "normal", padding = "3px 8px"),
textsize = "15px",
direction = "auto"))데이터 과학자 이광춘 저작
kwangchun.lee.7@gmail.com